home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / tex / style / misc / vpage.sty < prev    next >
Text File  |  1995-11-25  |  12KB  |  334 lines

  1. %%----------------------------------------------------------------------
  2. %% Vpage.sty
  3. %%
  4. %% Page size / layout macros. For use with LaTeX.
  5. %%
  6. %% (C) Volker Kuhlmann, 1993
  7. %%
  8. %% Explanation after (last) \endinput. Do not alter this file!
  9. %%----------------------------------------------------------------------
  10.  
  11. \immediate\typeout{Style `Vpage', V2.2, 18 June 1993}
  12.  
  13.  
  14. % so that Vpage can be loaded more than once
  15. \@ifundefined{@@@Vpage}{\def\@@@Vpage{l}}{\endinput}
  16.  
  17.  
  18. % Pre-defined paper sizes:
  19. %
  20. \def\paper@Azero        {\PaperWidth 841mm \PaperHeight1189mm\@po@}
  21. \def\paper@Aone         {\PaperWidth 595mm \PaperHeight 841mm\@po@}
  22. \def\paper@Atwo         {\PaperWidth 420mm \PaperHeight 595mm\@po@}
  23. \def\paper@Athree       {\PaperWidth 297mm \PaperHeight 420mm\@po@}
  24. \def\paper@Afour        {\PaperWidth 210mm \PaperHeight 297mm\@po@}
  25. \def\paper@Afive        {\PaperWidth 149mm \PaperHeight 210mm\@po@}
  26. \def\paper@Asix         {\PaperWidth 105mm \PaperHeight 149mm\@po@}
  27. \def\paper@Aseven       {\PaperWidth  74mm \PaperHeight 105mm\@po@}
  28. \def\paper@Aeight       {\PaperWidth  53mm \PaperHeight  74mm\@po@}
  29. \def\paper@Bzero        {\PaperWidth1000mm \PaperHeight1414mm\@po@}
  30. \def\paper@Bone         {\PaperWidth 707mm \PaperHeight1000mm\@po@}
  31. \def\paper@Btwo         {\PaperWidth 500mm \PaperHeight 707mm\@po@}
  32. \def\paper@Bthree       {\PaperWidth 353mm \PaperHeight 500mm\@po@}
  33. \def\paper@Bfour        {\PaperWidth 250mm \PaperHeight 353mm\@po@}
  34. \def\paper@Bfive        {\PaperWidth 176mm \PaperHeight 250mm\@po@}
  35. \def\paper@Czero        {\PaperWidth 917mm \PaperHeight1297mm\@po@}
  36. \def\paper@Cone         {\PaperWidth 648mm \PaperHeight 917mm\@po@}
  37. \def\paper@Ctwo         {\PaperWidth 458mm \PaperHeight 648mm\@po@}
  38. \def\paper@Cthree       {\PaperWidth 324mm \PaperHeight 458mm\@po@}
  39. \def\paper@Cfour        {\PaperWidth 229mm \PaperHeight 324mm\@po@}
  40. \def\paper@Cfive        {\PaperWidth 162mm \PaperHeight 229mm\@po@}
  41. \def\paper@Csix         {\PaperWidth 114mm \PaperHeight 162mm\@po@}
  42. \def\paper@Cseven       {\PaperWidth  81mm \PaperHeight 114mm\@po@}
  43. \def\paper@Ceight       {\PaperWidth  57mm \PaperHeight  81mm\@po@}
  44. \def\paper@USletter     {\PaperWidth 8.5in \PaperHeight 11in \@po@}
  45. \def\paper@USlegal      {\PaperWidth 8.5in \PaperHeight 14in \@po@}
  46. \def\paper@USexecutive  {\PaperWidth 7.25in\PaperHeight 10.5in\@po@}
  47. \def\paper@custom#1#2{   \PaperWidth #1    \PaperHeight #2\@po@}
  48.  
  49. %%----------------------------------------------------------------------
  50.  
  51. % new lengths: \PaperWidth, \PaperHeight
  52. % new if: \ifLandscape
  53.  
  54. \newdimen\PaperWidth
  55. \newdimen\PaperHeight
  56.  
  57. \newif\ifLandscape
  58.  
  59.  
  60. % macros
  61.  
  62. \def\setpapersize{\@ifnextchar[{\@@setps}{\@@setps[portrait]}}
  63. \def\@@setps[#1]#2{\csname po@#1\endcsname\csname paper@#2\endcsname}
  64. \def\po@portrait{\Landscapefalse}
  65. \def\po@landscape{\Landscapetrue}
  66. \def\@po@{\ifLandscape\dimen0\PaperWidth
  67.   \PaperWidth\PaperHeight\PaperHeight\dimen0\fi\relax}
  68.  
  69. \@ifundefined{margin@offset}{
  70. \def\margin@offset{
  71.         \oddsidemargin  0in
  72.         \evensidemargin 0in
  73.         \topmargin      0in
  74.         \hoffset        -1in    % to compensate for the
  75.         \voffset        -1in    %   +1in/+1in top/left corner
  76. }}{}
  77.  
  78. % leftmargin, topmargin, textwidth, textheight, 
  79. %   headheight, headsep, footheight, footskip
  80. \def\setmargins#1#2#3#4#5#6#7#8{%
  81.         \margin@offset
  82.         \advance\oddsidemargin  #1
  83.         \advance\evensidemargin \PaperWidth     % = paperwidth - left
  84.         \advance\evensidemargin -#1             %       - width
  85.         \advance\evensidemargin -#3
  86.         \advance\topmargin      #2
  87.         \textwidth      #3
  88.         \textheight     #4
  89.         \headheight     #5
  90.         \headsep        #6
  91.         \footheight     #7
  92.         \footskip       #8
  93.         \chk@dimen{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}
  94. }
  95.  
  96. % leftmargin, topmargin, rightmargin, bottommargin, 
  97. %   headheight, headsep, footheight, footskip
  98. \def\setmarginsrb#1#2#3#4#5#6#7#8{%
  99.         \margin@offset
  100.         \textwidth              \PaperWidth     % = paperwidth
  101.         \advance\textwidth      -#1             %  - left - right
  102.         \advance\textwidth      -#3
  103.         \textheight             \PaperHeight    % = paperheight - top
  104.         \advance\textheight     -#2             %  - headheight
  105.         \advance\textheight     -#5             %  - headsep
  106.         \advance\textheight     -#6             %  - footskip - bottom
  107.         \advance\textheight     -#8
  108.         \advance\textheight     -#4
  109.         \advance\oddsidemargin  #1
  110.         \advance\evensidemargin \PaperWidth     % = paperwidth
  111.         \advance\evensidemargin -#1             %  - left - width
  112.         \advance\evensidemargin -\textwidth
  113.         \advance\topmargin      #2
  114.         \headheight     #5
  115.         \headsep        #6
  116.         \footheight     #7
  117.         \footskip       #8
  118.         \chk@dimen{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}
  119. }
  120.  
  121. \def\chk@dimen#1#2#3#4#5#6#7#8{%
  122.         \dimen0=#1
  123.         \advance\dimen0 by#3
  124.         \advance\dimen0 by-\PaperWidth
  125.         \dimen1=#2
  126.         \advance\dimen1 by#5
  127.         \advance\dimen1 by#6
  128.         \advance\dimen1 by#4
  129.         \advance\dimen1 by#8
  130.         \advance\dimen1 by-\PaperHeight
  131.         \ifnum\dimen0>\z@\typeout{Vpage Warning: Horizontal dimensions
  132.           exceed paper width by \the\dimen0}\fi\relax
  133.         \ifnum\dimen1>\z@\typeout{Vpage Warning: Vertical dimensions
  134.           exceed paper height by \the\dimen1}\fi\relax
  135. }
  136.  
  137.  
  138. %
  139. % DEFAULTS:
  140. %
  141. \setpapersize{Afour}
  142. %\setmarginsrb{25mm}{20mm}{20mm}{10mm}{12pt}{0mm}{0pt}{10mm}
  143. \setmarginsrb{35mm}{20mm}{25mm}{15mm}{12pt}{11mm}{0pt}{11mm}
  144. \parskip                2ex plus 0.5ex minus 0.5ex
  145. \parindent              0em
  146. \clubpenalty            500             % 150 by plain
  147. \widowpenalty           500             % 150 by plain
  148. \displaywidowpenalty    100             %  50 by plain
  149. \brokenpenalty          250             % 100 by plain
  150. \marginparwidth         15mm
  151. \marginparsep           3.5mm
  152. \skip\footins           1.3\skip\footins
  153. \footnotesep            1.2\footnotesep
  154. \def\baselinestretch{1.0}
  155. \def\arraystretch{1.0}
  156. \def\textfraction{.2}
  157. %\def\topfraction{.8}
  158. %\def\bottomfraction{.2}
  159. \flushbottom
  160.  
  161.  
  162. \endinput
  163.  
  164. %%----------------------------------------------------------------------
  165.  
  166. Page Size and Margins
  167. =====================
  168.  
  169. These macros make it easy to set page margins for a chosen paper size.
  170. Actual dimensions of the most common paper sizes are stored and need
  171. not be remembered.
  172.  
  173. Two sided printing is supported, meaning if on odd pages the left
  174. margin is, say, 30mm and the right margin is 20mm, it will be vice
  175. versa on even pages. This gives equal margins on the outer and the
  176. inner edge of the paper, as expected e.g. for a book.
  177.  
  178. The size of the paper can be set with 
  179.  
  180.         \setpapersize{<size>}
  181.  
  182. <size> can be Afour, Bfive, USletter, ... A list of the pre-defined
  183. paper sizes appears at the beginning of this file. 
  184.  
  185. Landscape format is selected by using the optional argument
  186.  
  187.         \setpapersize[landscape]{<size>}
  188.  
  189. which swaps the width and height dimensions of the paper.
  190. \setpapersize[portrait]{<size>} is allowed but is the default.
  191.  
  192. If you have a size which is not pre-defined use
  193.  
  194.         \setpapersize{custom}{<width>}{<height>}
  195.  
  196. For <width> and <height> insert the respective dimensions of your
  197. paper.
  198.  
  199. \setpapersize stores the actual dimensions of the paper in the length
  200. variables
  201.  
  202.         \PaperWidth
  203.         \PaperHeight
  204.  
  205. which can be used further, if desired.
  206.  
  207.         \ifLandscape
  208.  
  209. yields true if a landscape format is selected. Do not write
  210. \PaperWidth, \PaperHeight, or call \Landscapetrue or \Landscapefalse,
  211. it will not work!!
  212.  
  213. The margins can be set with
  214.  
  215.         \setmargins{leftmargin}{topmargin}{textwidth}{textheight}%
  216.                    {headheight}{headsep}{footheight}{footskip}
  217.  
  218. or with
  219.  
  220.         \setmarginsrb{leftmargin}{topmargin}{rightmargin}{bottommargin}%
  221.                      {headheight}{headsep}{footheight}{footskip}
  222.  
  223. In the latter case \textwidth and \textheight are calculated. The first
  224. four parameters of the above two commands are used to set
  225. \oddsidemargin, \evensidemargin, \textwidth, \topmargin, and
  226. \textheight.
  227.  
  228. Example:
  229.  
  230.         A4 paper, left margin 30mm, top, right, and bottom margin 20mm
  231.         each, no headers or footers:
  232.  
  233.         \setpapersize{Afour}
  234.         \setmarginsrb{30mm}{20mm}{20mm}{20mm}{0pt}{0mm}{0pt}{0mm}
  235.         \pagestyle{empty}
  236.  
  237. For the default settings please see the part after "DEFAULTS:" (last
  238. part before \endinput).  This style also sets several other paragraph
  239. parameters to new values.
  240.  
  241. The default top and left margins of TeX are +1in. \setmargins
  242. or \setmarginsrb call
  243.  
  244.         \margin@offset
  245.  
  246. which sets \hoffset, \voffset to -1in before \setmargins or
  247. \setmarginsrb add the values specified to \topmargin, \oddsidemargin,
  248. \evensidemargin. If \margin@offset is already defined at the time Vpage
  249. is loaded it is NOT redefined! Therefore if \margin@offset is defined
  250. before Vpage is loaded the above mentioned margins can be set to other
  251. values than -1in before the values specified with \setmargin or
  252. \setmarginsrb are added.  \margin@offset should be defined in a
  253. separate file which is included BEFORE Vpage, i.e. appears in the list
  254. of document-substyles of the \documentstyle command before Vpage.
  255.  
  256. Example:  \documentstyle[...,margins,Vpage,...]{...} 
  257.           if \margin@offset is defined in a file called margins.sty.
  258.  
  259.  
  260. Hints for using pageframe.sty
  261. -----------------------------
  262.  
  263. Vpage.sty and pageframe.sty can be used together if the following
  264. points are considered:
  265.  
  266. Vpage uses \hoffset and \voffset and writes negative values into it,
  267. pageframe expects them to be zero to give a 1in space on the left and
  268. the top where it prints additional information. Initially, set both to
  269. 0mm (in the pre-amble of your text) and adjust them later on.
  270.  
  271. pageframe needs to know the trimmed height of the paper (= the height
  272. of the "page frame"). Unless the trimmed(!) size of the paper is
  273. equivalent to one of the standard paper sizes (unlikely...) the size
  274. should be specified with
  275.  
  276.         \setpapersize{custom}{<width>}{<height>}
  277.  
  278. The correct height of the trimmed page can then be given to pageframe
  279. using
  280.  
  281.         \paperheight{\PaperHeight}
  282.  
  283. and the margins of the final product (inside the page frame) can be
  284. specified using \setmargins or \setmarginsrb.
  285.  
  286. Warning: if \setmarginsrb is used the 3rd parameter (right margin) is
  287. ignored. Instead, the dimension of the right margin has to be assigned
  288. to \evensidemargin. This is because pageframe.sty re-defines the meaning
  289. of \evensidemargin to be the right margin of your text.
  290.  
  291. All these assignments and macro calls have to be done in the pre-amble
  292. of your document.
  293.  
  294.  
  295.  
  296. SUMMARY:
  297. --------
  298.  
  299. new lengths:
  300.   \PaperWidth
  301.   \PaperHeight
  302.  
  303. new ifs:
  304.   \ifLandscape
  305.  
  306. new macros:
  307.   \setpapersize[<orientation>]{<size>}, 
  308.   \setpapersize[<orientation>]{custom}{<width>}{<height>}
  309.         <orientation> (optional) = landscape or portrait (default)
  310.         <size> = Afour, Bfive, ...
  311.         <width>, <height> = actual dimensions of the paper
  312.   \setmargins{leftmargin}{topmargin}{textwidth}{textheight}%
  313.              {headheight}{headsep}{footheight}{footskip}
  314.   \setmarginsrb{leftmargin}{topmargin}{rightmargin}{bottommargin}%
  315.                {headheight}{headsep}{footheight}{footskip}
  316. %
  317.   \margin@offset
  318.  
  319.  
  320. If you have any comments (positive or negative) please let me know!
  321.  
  322.  
  323. Copyright (C) Volker Kuhlmann
  324.  
  325. Use of these macros is granted free of charge provided that this file
  326. is left intact and that no charge is made for its distribution.
  327.  
  328. Currently: 26 Woodford Tce, Christchurch, New Zealand.
  329.            KUHLMAV@elec.canterbury.ac.nz
  330. %
  331. %% EOF Vpage.sty
  332. %%----------------------------------------------------------------------
  333.  
  334.